#include "weather.h"
#include "serial.h"

// 存储天气信息的全局变量
WeatherInfo currentWeather;

void weatherInit() {
    serialPrint("初始化天气模块...");
    // 设置默认值
    currentWeather.city = "未知";
    currentWeather.weather = "未知";
    currentWeather.temp = "0";
    currentWeather.humidity = "0";
    serialPrint("天气模块初始化完成");
}

void weatherSetInfo(const String &city, const String &weather, const String &temp, const String &humidity) {
    currentWeather.city = city;
    currentWeather.weather = weather;
    currentWeather.temp = temp;
    currentWeather.humidity = humidity;
    
    serialPrint("手动设置天气信息:");
    serialPrint("城市: " + currentWeather.city);
    serialPrint("天气: " + currentWeather.weather);
    serialPrint("温度: " + currentWeather.temp + "°C");
    serialPrint("湿度: " + currentWeather.humidity + "%");
}

WeatherInfo weatherGetInfo() {
    return currentWeather;
}